package com.google.code.gronono.commons.swing.listeners;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * Listener permettant d'écouter les doubles clics.
 *
 * @author Arnaud Brunet
 */
public abstract class DoubleClickListener extends MouseAdapter {

	/*
	 * (non-Javadoc)
	 * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseClicked(final MouseEvent e) {
		if ((e.getButton() == MouseEvent.BUTTON1) && (e.getClickCount() == 2)) {
			mouseDoubleClicked(e);
		}
	}

	/**
	 * Déclenchée lors d'un double-clic.
	 * @param e L'évènement déclencheur.
	 */
	protected abstract void mouseDoubleClicked(MouseEvent e);

}
